#include <string.h>
#include <stdio.h>
#include <unistd.h>
//verson2
#define NUM 101
#define TYPE '='
void process(double current , double totol)
{
  char bar[NUM];
  char s[8];
  memset(s,'\0',8);
  static int num = 0;
  int pi = 0;
  while(pi < num)
  {
    s[pi] = '.';
    pi++;
  }
  num = (num+1)%8;
  memset(bar,'\0',NUM);
  double ratio = (current/totol)*100;
  int i = 0;
  while(i < (int)current)
  {
    bar[i] = TYPE;
    i++;
  }
  printf("[%-100s][%.1lf%%]%-8s\r",bar,ratio,s);
  fflush(stdout);
  usleep(100000);
}





////verson1
//#define NUM 101
//#define TYPE '='
////void process()
////{
////  const char* table = "|\\-/";
////  char a[101];
////  memset(a,'\0',sizeof(a));
////  int cont = 0;
////  while(cont < NUM)
////  {
////    printf("[%-100s][%d%%][%c]\r",a,cont,table[cont%4]);
////    a[cont] = TYPE;
////    cont++;
////    fflush(stdout);
////    if(cont < NUM - 1)
////    {
////      a[cont] = '>';
////    }
////    usleep(100000);
////  }
////  printf("\r\n");
////}
